package cn.tedu._01mvcboot01.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BMIController {

    @RequestMapping("/bmi")
    @ResponseBody
    public String bmi(double height,double weight){
        String a;
        double result=weight/(height*height);
        if (result<18.5){
            a="偏瘦";
        } else if (result<24) {
            a="正常";
        } else if (result<27) {
            a="偏胖";
        } else {
            a="该减肥了";
        }
        return a;
    }
}
